<template>
  <div class="run-container">
    <div class="run-core">
      <el-card class="run-card">

        <el-form ref="form" :model="form" label-width="80px">
          <el-form-item label="基本工资">
            <el-input v-model="form.basePay"></el-input>
          </el-form-item>
          <el-form-item label="年限">
            <el-input v-model="form.years"></el-input>
          </el-form-item>
          <el-form-item label="奖金">
            <el-input v-model="form.bonus"></el-input>
          </el-form-item>
          <el-form-item label="缴税金额">
            <el-input v-model="form.tax"></el-input>
          </el-form-item>

          <el-form-item>
            <el-button type="primary" @click="addPay" style="margin-left: 2rem">添加</el-button>
            <el-button>取消</el-button>
          </el-form-item>
        </el-form>

      </el-card>
    </div>
  </div>
</template>

<script>
import {saveOrUpdateOrg} from "@/api/pay";

export default {
  data(){
    return{
      form:{}
    }
  },
  methods: {
    async addPay(){
      const res = await saveOrUpdateOrg(this.form)
      console.log(res)
      if (res.code === 200){
        this.$message({message: res.message, type: 'success'});
        this.$router.push({path:'/pay/list'})
      }else{
        this.$message.error(res.message);
      }

    }

  },
  created() {
    this.form.positionId = this.$route.params.id
  }
}
</script>

<style lang="scss" scoped>
.run{
  &-core{
    margin:0 2rem 0 2rem;
  }
  &-card{
    margin-top: 2rem;
  }
}
.el-form{
  margin:0 40rem 0 40rem;

}

</style>
